<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMaterialsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('materials', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('material_classify_id')->index()->nullable()->comment('分类ID');
            $table->integer('supplier_id')->index()->nullable()->comment('供应商ID');
            $table->string('name',50)->index()->nullable()->comment('材料名称');
            $table->integer('stock')->index()->default(0)->comment('库存');
            $table->string('number')->index()->default(0)->comment('材料编号');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('materials');
    }
}
